package com.sl.biz.modular.cdc.controller;

import com.sl.biz.modular.cdc.controller.domain.request.CdcDatabaseGroupRequest;
import com.sl.biz.modular.cdc.dao.domain.entity.CdcDatabaseConfigDO;
import com.sl.biz.modular.cdc.service.CdcDatabaseBizService;
import com.sl.biz.modular.cdc.service.domain.dto.CdcDatabaseGroupDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/cdc/database")
@RequiredArgsConstructor
public class CdcDatabaseController {

    private final CdcDatabaseBizService cdcDatabaseBizService;


    @PostMapping("/query_by_cdc_id")
    public List<CdcDatabaseGroupDTO> queryByCdcId(@RequestBody CdcDatabaseConfigDO jobConfigDO) {
        return cdcDatabaseBizService.queryByCdcId(jobConfigDO);
    }

    @PostMapping("/save")
    public Boolean save(@RequestBody CdcDatabaseGroupRequest jobConfigDO) {
        return cdcDatabaseBizService.save(jobConfigDO);
    }
}
